package com.coolingme.pay;

/**
 * 订单，作为上下文角色
 *
 * @author wangyue
 * @date 2020-09-22 23:10
 */
public class Order {

    private String userId;

    private double money;

    public Order(String userId, double money) {
        this.userId = userId;
        this.money = money;
    }

    public String pay(String type) {
        Payment payment = PayType.getPayment(type);
        return payment.pay(userId, money);
    }

    /**
     * 重载，默认调用默认支付方式
     *
     * @return 支付结果
     */
    public String pay() {
        return pay(PayType.DEFAULT_PAY);
    }
}
